bcffab9ef917d92b7ddce3bce9be1cbac00eeb77,cdap-gateway/src/main/java/co/cask/cdap/gateway/router/DatasetsProxyRule.java,DatasetsProxyRule,apply,#HttpRequest#,38
Before Change
public HttpRequest apply(HttpRequest request) {
String path = URI.create(request.getUri()).normalize().getPath();
String[] uriParts = StringUtils.split(path, '/');
if ((uriParts.length >= 4) && uriParts[1].equals("data") && uriParts[2].equals("datasets")) {
// three parts with '/' wrapping them
int insertAt = uriParts[0].length() + uriParts[1].length() + uriParts[2].length() + 4;
String datasetName = uriParts[3];
request.setUri(processDatasetPath(path, insertAt, datasetName));
} else if ((uriParts.length == 6) && uriParts[1].equals("data") && uriParts[2].equals("explore")
&& uriParts[3].equals("datasets") && uriParts[5].equals("schema")) {
// four parts with '/' wrapping them
int insertAt = uriParts[0].length() + uriParts[1].length() + uriParts[2].length() + uriParts[3].length() + 5;
String datasetName = uriParts[4];
request.setUri(processDatasetPath(path, insertAt, datasetName));
}
After Change
public HttpRequest apply(HttpRequest request) {
String path = URI.create(request.getUri()).normalize().getPath();
String[] uriParts = StringUtils.split(path, '/');
if (uriParts[0].equals(Constants.Gateway.API_VERSION_2_TOKEN)) {
return applyToV2(request, uriParts, path);
} else if (uriParts[0].equals(Constants.Gateway.API_VERSION_3_TOKEN)) {
return applyToV3(request, uriParts, path);